package com.ruoyi.locksApi.controller;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.websocket.service.WebSocketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author arvin * @date 2023/11/1 10:38 * @version 1.0
 */
@RestController
@RequestMapping("/websocket")
public class websocket {

    @Autowired
    private WebSocketService webSocketService;

    @Anonymous
    @GetMapping("/send")
    public AjaxResult socketSend(String itPlan) {
        JSONObject json = new JSONObject();
        json.put("code","0");
        json.put("type","addpwd");
        json.put("msg","delPwd密码不存在");
        webSocketService.sendMessageByUserId(1L, json);

        return AjaxResult.success();

    }

}
